package com.wangsong.service;

import com.wangsong.model.MUserIdError;
import com.wangsong.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * 手机号码验证
 * User: zhoujingjie
 * Date: 14-11-1
 * Time: 上午10:45
 */
public class MUserIdErrorValidator implements ConstraintValidator<MUserIdError, String> {
    @Autowired
    private TestService testService;

    @Override
    public void initialize(MUserIdError constraintAnnotation) {
    }


    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        return testService.test(value);
    }
}
